<template>
  <a-modal class="common-modal check-all-modal" :title="title" :footer="null" :width="720" :visible="visible" @cancel="handleCancel" :maskClosable="false" style="top:5%;">
    <a-spin :spinning="confirmLoading">
      <div class="common-modal-content">
        <p>
          {{ $t('common.all') }}  {{title}}:
        </p>
        <article v-if="recordIds.length">
          <a-tag v-for="(item ) in recordIds" :key="item.key">{{item.title}}</a-tag>
        </article>

      </div>
      <div class="common-modal-footer">
        <a-button @click="handleCancel" type="primary" class="confirm">{{$t('common.ok')}}</a-button>
      </div>
    </a-spin>
  </a-modal>
</template>

<script setup>
import { nextTick, ref } from 'vue'
import i18n from '@/locales/index'
const { t } = i18n.global
let visible = ref(false)
let confirmLoading = ref(false)
let title = ref('')
let recordIds = ref([])
const initModalData = () => {

}
const open = async (type,list) => {
  title.value = type == 'station' ? t('other.prodSite') : t('other.pordUser')
  recordIds.value = list || []
  initModalData()
  visible.value = true
  await nextTick()
}
const handleCancel = () => {
  visible.value = false
  confirmLoading.value = false

  visible.value = false
}

defineExpose({
  open
})
</script>
